package com.landiao.ctrler.management;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.landiao.ctrler.BaseCRUDCtrler;
import com.landiao.entities.Mdse;
import com.landiao.service.MdseService;

/**
 * 功能说明:商品
 *
 */
@Controller
@RequestMapping("/management/mdse")
public class MdseCtrler extends BaseCRUDCtrler<Mdse, String> {
	
	private MdseService getMdseService() {
        return (MdseService) baseService;
    }

	/**
	 * 验证是否存在
	 * 
	 */
	@RequestMapping("isExist")
	@ResponseBody
	public boolean isExist(Mdse para) {
		String mdseId = para.getMdseId();
		if(StringUtils.isNotEmpty(mdseId));{
			para.setMdseId(null);
		}
		Mdse mdse = this.getMdseService().getOneByMdse(para);
		if (mdse == null) {
			return true;
		}else{
			if(mdse.getMdseId().equals(mdseId)){
				return true;
			}else{
				return false;
			}
		}
	}
}
